<template>
  <div style="padding: 5px 15px 30px 15px">
    <nut-cell :title="item.name" :sub-title="item.time" :desc="item.exam_room" v-for="item in examData"
              v-bind:key="item"></nut-cell>

    <div v-if="examData.length === 0 && !loading" style="text-align: center;padding: 100px 0">
      <nut-icon name="order" color="#64b578" size="48"></nut-icon>
      <br>
      暂无考试
    </div>

    <div v-if="loading" style="text-align: center;padding: 100px 0">
      <nut-icon name="loading" />
      <div>加载中...</div>
    </div>
  </div>
</template>

<script>
import global from "@/components/global";

export default {
  name: "exam",
  data() {
    return {
      examData: [],
      loading: false
    }
  },
  methods: {
    loadData() {
      let that = this
      this.loading = true
      global.http(this, 'api/user/exam/', {
        success(r) {
          that.examData = r.data.exam
          console.log(r.data)
        },
        complete(){
          that.loading = false
        }
      })
    }
  },
  mounted() {
    this.loadData()
  }
}
</script>

<style scoped>

</style>